package com.example.service;

import com.example.Product;
import com.example.feign.FeignClientConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 测试产品feign接口
 *
 * @author sunhui
 */
@FeignClient(name = "CLOUD-ADMIN-PROVIDER-PRODUCT-HYSTRIX", configuration = FeignClientConfig.class,
        fallbackFactory = IProductClientServiceFallbackFactory.class)
public interface IProductClientService {
    /**
     * 测试接口-根据id查询产品
     *
     * @param id
     * @return
     */
    @RequestMapping("/prodcut/get/{id}")
    public Product getProduct(@PathVariable("id") long id);


    /**
     * 测试接口-查询所有产品
     *
     * @return
     */
    @RequestMapping("/prodcut/list")
    public List<Product> listProduct();

    /**
     * 测试接口-添加产品
     *
     * @param product
     * @return
     */
    @RequestMapping("/prodcut/add")
    public boolean addPorduct(Product product);
}
